<?php

use app\common\lib\Redis;
use \think\Db;

class ArticleHelper
{


    public static function getArticle($cate = 1, $limit = 10)
    {
        $articles = Db::name('article')
            ->where('cate_id','in',$cate)
            ->where('status',1)
            ->order('add_time')
            ->paginate($limit);
        return $articles;
    }
    public static function getArticleInfo($id = 1,$cate_id = [])
    {
        $article = Db::name('article')
            ->where('id',$id)
            ->where('status',1);
        if(empty($cate_id)){
            return $article->find();
        }else{
            return $article->where('cate_id','in',$cate_id)->find();
        }
    }
}